<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-- | ISO 8601 Ordinal Date format</span><span>
</span><span id="line-2"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Time.Calendar.OrdinalDate</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html"><span class="hs-identifier">Data.Time.Calendar.Days</span></a></span><span>
</span><span id="line-5"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Private.html"><span class="hs-identifier">Data.Time.Calendar.Private</span></a></span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-comment">-- | Convert to ISO 8601 Ordinal Date format. First element of result is year (proleptic Gregoran calendar),</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- second is the day of the year, with 1 for Jan 1, and 365 (or 366 in leap years) for Dec 31.</span><span>
</span><span id="line-9"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#toOrdinalDate"><span class="hs-identifier hs-type">toOrdinalDate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span class="hs-special">,</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span>
</span><span id="line-10"></span><span id="toOrdinalDate"><span class="annot"><span class="annottext">toOrdinalDate :: Day -&gt; (Integer, Int)
</span><a href="Data.Time.Calendar.OrdinalDate.html#toOrdinalDate"><span class="hs-identifier hs-var hs-var">toOrdinalDate</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Time.Calendar.Days.html#ModifiedJulianDay"><span class="hs-identifier hs-type">ModifiedJulianDay</span></a></span><span> </span><span id="local-6989586621679068189"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068189"><span class="hs-identifier hs-var">mjd</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068188"><span class="hs-identifier hs-var">year</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068187"><span class="hs-identifier hs-var">yd</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-11"></span><span>    </span><span id="local-6989586621679068184"><span class="annot"><span class="annottext">a :: Integer
</span><a href="#local-6989586621679068184"><span class="hs-identifier hs-var hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068189"><span class="hs-identifier hs-var">mjd</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">678575</span></span><span>
</span><span id="line-12"></span><span>    </span><span id="local-6989586621679068180"><span class="annot"><span class="annottext">quadcent :: Integer
</span><a href="#local-6989586621679068180"><span class="hs-identifier hs-var hs-var">quadcent</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068184"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">146097</span></span><span>
</span><span id="line-13"></span><span>    </span><span id="local-6989586621679068176"><span class="annot"><span class="annottext">b :: Integer
</span><a href="#local-6989586621679068176"><span class="hs-identifier hs-var hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068184"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">146097</span></span><span>
</span><span id="line-14"></span><span>    </span><span id="local-6989586621679068170"><span class="annot"><span class="annottext">cent :: Integer
</span><a href="#local-6989586621679068170"><span class="hs-identifier hs-var hs-var">cent</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">min</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068176"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">36524</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">3</span></span><span>
</span><span id="line-15"></span><span>    </span><span id="local-6989586621679068165"><span class="annot"><span class="annottext">c :: Integer
</span><a href="#local-6989586621679068165"><span class="hs-identifier hs-var hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068176"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068170"><span class="hs-identifier hs-var">cent</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">36524</span></span><span class="hs-special">)</span><span>
</span><span id="line-16"></span><span>    </span><span id="local-6989586621679068161"><span class="annot"><span class="annottext">quad :: Integer
</span><a href="#local-6989586621679068161"><span class="hs-identifier hs-var hs-var">quad</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068165"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1461</span></span><span>
</span><span id="line-17"></span><span>    </span><span id="local-6989586621679068158"><span class="annot"><span class="annottext">d :: Integer
</span><a href="#local-6989586621679068158"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068165"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1461</span></span><span>
</span><span id="line-18"></span><span>    </span><span id="local-6989586621679068153"><span class="annot"><span class="annottext">y :: Integer
</span><a href="#local-6989586621679068153"><span class="hs-identifier hs-var hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">min</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068158"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">365</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">3</span></span><span>
</span><span id="line-19"></span><span>    </span><span id="local-6989586621679068187"><span class="annot"><span class="annottext">yd :: Int
</span><a href="#local-6989586621679068187"><span class="hs-identifier hs-var hs-var">yd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068158"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068153"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">365</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-20"></span><span>    </span><span id="local-6989586621679068188"><span class="annot"><span class="annottext">year :: Integer
</span><a href="#local-6989586621679068188"><span class="hs-identifier hs-var hs-var">year</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068180"><span class="hs-identifier hs-var">quadcent</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">400</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068170"><span class="hs-identifier hs-var">cent</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">100</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068161"><span class="hs-identifier hs-var">quad</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068153"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-21"></span><span>
</span><span id="line-22"></span><span class="hs-comment">-- | Convert from ISO 8601 Ordinal Date format.</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- Invalid day numbers will be clipped to the correct range (1 to 365 or 366).</span><span>
</span><span id="line-24"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDate"><span class="hs-identifier hs-type">fromOrdinalDate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-25"></span><span id="fromOrdinalDate"><span class="annot"><span class="annottext">fromOrdinalDate :: Integer -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDate"><span class="hs-identifier hs-var hs-var">fromOrdinalDate</span></a></span></span><span> </span><span id="local-6989586621679068134"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068134"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span id="local-6989586621679068133"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068133"><span class="hs-identifier hs-var">day</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#ModifiedJulianDay"><span class="hs-identifier hs-var">ModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068132"><span class="hs-identifier hs-var">mjd</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-26"></span><span>    </span><span id="local-6989586621679068129"><span class="annot"><span class="annottext">y :: Integer
</span><a href="#local-6989586621679068129"><span class="hs-identifier hs-var hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068134"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-27"></span><span>    </span><span id="local-6989586621679068132"><span class="annot"><span class="annottext">mjd :: Integer
</span><a href="#local-6989586621679068132"><span class="hs-identifier hs-var hs-var">mjd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int -&gt; Int
forall t. Ord t =&gt; t -&gt; t -&gt; t -&gt; t
</span><a href="Data.Time.Calendar.Private.html#clip"><span class="hs-identifier hs-var">clip</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Bool
</span><a href="Data.Time.Calendar.OrdinalDate.html#isLeapYear"><span class="hs-identifier hs-var">isLeapYear</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068134"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">366</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">365</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068133"><span class="hs-identifier hs-var">day</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">365</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068129"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068129"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068129"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">100</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068129"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">400</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">678576</span></span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-comment">-- | Convert from ISO 8601 Ordinal Date format.</span><span>
</span><span id="line-30"></span><span class="hs-comment">-- Invalid day numbers return 'Nothing'</span><span>
</span><span id="line-31"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDateValid"><span class="hs-identifier hs-type">fromOrdinalDateValid</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-32"></span><span id="fromOrdinalDateValid"><span class="annot"><span class="annottext">fromOrdinalDateValid :: Integer -&gt; Int -&gt; Maybe Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDateValid"><span class="hs-identifier hs-var hs-var">fromOrdinalDateValid</span></a></span></span><span> </span><span id="local-6989586621679068104"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068104"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span id="local-6989586621679068103"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068103"><span class="hs-identifier hs-var">day</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-33"></span><span>    </span><span id="local-6989586621679068102"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068102"><span class="hs-identifier hs-var">day'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int -&gt; Maybe Int
forall t. Ord t =&gt; t -&gt; t -&gt; t -&gt; Maybe t
</span><a href="Data.Time.Calendar.Private.html#clipValid"><span class="hs-identifier hs-var">clipValid</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Bool
</span><a href="Data.Time.Calendar.OrdinalDate.html#isLeapYear"><span class="hs-identifier hs-var">isLeapYear</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068104"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">366</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">365</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068103"><span class="hs-identifier hs-var">day</span></a></span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-35"></span><span>        </span><span id="local-6989586621679068098"><span class="annot"><span class="annottext">y :: Integer
</span><a href="#local-6989586621679068098"><span class="hs-identifier hs-var hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068104"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">1</span></span><span>
</span><span id="line-36"></span><span>        </span><span id="local-6989586621679068081"><span class="annot"><span class="annottext">mjd :: Integer
</span><a href="#local-6989586621679068081"><span class="hs-identifier hs-var hs-var">mjd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a b. (Integral a, Num b) =&gt; a -&gt; b
</span><a href="../../base/src/GHC.Real.html#fromIntegral"><span class="hs-identifier hs-var">fromIntegral</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068102"><span class="hs-identifier hs-var">day'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">365</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068098"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068098"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">4</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068098"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">100</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068098"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">400</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">678576</span></span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><span class="annottext">Day -&gt; Maybe Day
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#ModifiedJulianDay"><span class="hs-identifier hs-var">ModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068081"><span class="hs-identifier hs-var">mjd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-comment">-- | Show in ISO 8601 Ordinal Date format (yyyy-ddd)</span><span>
</span><span id="line-40"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#showOrdinalDate"><span class="hs-identifier hs-type">showOrdinalDate</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-41"></span><span id="showOrdinalDate"><span class="annot"><span class="annottext">showOrdinalDate :: Day -&gt; String
</span><a href="Data.Time.Calendar.OrdinalDate.html#showOrdinalDate"><span class="hs-identifier hs-var hs-var">showOrdinalDate</span></a></span></span><span> </span><span id="local-6989586621679068079"><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068079"><span class="hs-identifier hs-var">date</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; String
forall t. ShowPadded t =&gt; t -&gt; String
</span><a href="Data.Time.Calendar.Private.html#show4"><span class="hs-identifier hs-var">show4</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068077"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-&quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; String
forall t. ShowPadded t =&gt; t -&gt; String
</span><a href="Data.Time.Calendar.Private.html#show3"><span class="hs-identifier hs-var">show3</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068075"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679068077"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068077"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621679068075"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068075"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Day -&gt; (Integer, Int)
</span><a href="Data.Time.Calendar.OrdinalDate.html#toOrdinalDate"><span class="hs-identifier hs-var">toOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068079"><span class="hs-identifier hs-var">date</span></a></span><span>
</span><span id="line-43"></span><span>
</span><span id="line-44"></span><span class="hs-comment">-- | Is this year a leap year according to the proleptic Gregorian calendar?</span><span>
</span><span id="line-45"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#isLeapYear"><span class="hs-identifier hs-type">isLeapYear</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-46"></span><span id="isLeapYear"><span class="annot"><span class="annottext">isLeapYear :: Integer -&gt; Bool
</span><a href="Data.Time.Calendar.OrdinalDate.html#isLeapYear"><span class="hs-identifier hs-var hs-var">isLeapYear</span></a></span></span><span> </span><span id="local-6989586621679068074"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068074"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068074"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068074"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">400</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068074"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">100</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span>
</span><span id="line-48"></span><span class="hs-comment">-- | Get the number of the Monday-starting week in the year and the day of the week.</span><span>
</span><span id="line-49"></span><span class="hs-comment">-- The first Monday is the first day of week 1, any earlier days in the year are week 0 (as @%W@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-50"></span><span class="hs-comment">-- Monday is 1, Sunday is 7 (as @%u@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-51"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#mondayStartWeek"><span class="hs-identifier hs-type">mondayStartWeek</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span id="mondayStartWeek"><span class="annot"><span class="annottext">mondayStartWeek :: Day -&gt; (Int, Int)
</span><a href="Data.Time.Calendar.OrdinalDate.html#mondayStartWeek"><span class="hs-identifier hs-var hs-var">mondayStartWeek</span></a></span></span><span> </span><span id="local-6989586621679068069"><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068069"><span class="hs-identifier hs-var">date</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068068"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068067"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">Integer -&gt; Int
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068068"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-53"></span><span>    </span><span id="local-6989586621679068066"><span class="annot"><span class="annottext">yd :: Int
</span><a href="#local-6989586621679068066"><span class="hs-identifier hs-var hs-var">yd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer, Int) -&gt; Int
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Day -&gt; (Integer, Int)
</span><a href="Data.Time.Calendar.OrdinalDate.html#toOrdinalDate"><span class="hs-identifier hs-var">toOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068069"><span class="hs-identifier hs-var">date</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span>    </span><span id="local-6989586621679068068"><span class="annot"><span class="annottext">d :: Integer
</span><a href="#local-6989586621679068068"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#toModifiedJulianDay"><span class="hs-identifier hs-var hs-var">toModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068069"><span class="hs-identifier hs-var">date</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">2</span></span><span>
</span><span id="line-55"></span><span>    </span><span id="local-6989586621679068067"><span class="annot"><span class="annottext">k :: Integer
</span><a href="#local-6989586621679068067"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068068"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068066"><span class="hs-identifier hs-var">yd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-comment">-- | Get the number of the Sunday-starting week in the year and the day of the week.</span><span>
</span><span id="line-58"></span><span class="hs-comment">-- The first Sunday is the first day of week 1, any earlier days in the year are week 0 (as @%U@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-59"></span><span class="hs-comment">-- Sunday is 0, Saturday is 6 (as @%w@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-60"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#sundayStartWeek"><span class="hs-identifier hs-type">sundayStartWeek</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">,</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">)</span><span>
</span><span id="line-61"></span><span id="sundayStartWeek"><span class="annot"><span class="annottext">sundayStartWeek :: Day -&gt; (Int, Int)
</span><a href="Data.Time.Calendar.OrdinalDate.html#sundayStartWeek"><span class="hs-identifier hs-var hs-var">sundayStartWeek</span></a></span></span><span> </span><span id="local-6989586621679068059"><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068059"><span class="hs-identifier hs-var">date</span></a></span></span><span> </span><span class="hs-glyph">=</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Int
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068058"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#div"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068057"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span class="annot"><span class="annottext">Integer -&gt; Int
forall a. Num a =&gt; Integer -&gt; a
</span><a href="../../base/src/GHC.Num.html#fromInteger"><span class="hs-identifier hs-var">fromInteger</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068058"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-62"></span><span>    </span><span id="local-6989586621679068056"><span class="annot"><span class="annottext">yd :: Int
</span><a href="#local-6989586621679068056"><span class="hs-identifier hs-var hs-var">yd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Integer, Int) -&gt; Int
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Day -&gt; (Integer, Int)
</span><a href="Data.Time.Calendar.OrdinalDate.html#toOrdinalDate"><span class="hs-identifier hs-var">toOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068059"><span class="hs-identifier hs-var">date</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-63"></span><span>    </span><span id="local-6989586621679068058"><span class="annot"><span class="annottext">d :: Integer
</span><a href="#local-6989586621679068058"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#toModifiedJulianDay"><span class="hs-identifier hs-var hs-var">toModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068059"><span class="hs-identifier hs-var">date</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">3</span></span><span>
</span><span id="line-64"></span><span>    </span><span id="local-6989586621679068057"><span class="annot"><span class="annottext">k :: Integer
</span><a href="#local-6989586621679068057"><span class="hs-identifier hs-var hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068058"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068056"><span class="hs-identifier hs-var">yd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-65"></span><span>
</span><span id="line-66"></span><span class="hs-comment">-- | The inverse of 'mondayStartWeek'. Get a 'Day' given the year,</span><span>
</span><span id="line-67"></span><span class="hs-comment">-- the number of the Monday-starting week, and the day of the week.</span><span>
</span><span id="line-68"></span><span class="hs-comment">-- The first Monday is the first day of week 1, any earlier days in the year</span><span>
</span><span id="line-69"></span><span class="hs-comment">-- are week 0 (as @%W@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-70"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#fromMondayStartWeek"><span class="hs-identifier hs-type">fromMondayStartWeek</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-comment">-- ^ Year.</span><span>
</span><span id="line-71"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Monday-starting week number (as @%W@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-72"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Day of week.</span><span>
</span><span id="line-73"></span><span>                               </span><span class="hs-comment">-- Monday is 1, Sunday is 7 (as @%u@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-74"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-75"></span><span id="fromMondayStartWeek"><span class="annot"><span class="annottext">fromMondayStartWeek :: Integer -&gt; Int -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromMondayStartWeek"><span class="hs-identifier hs-var hs-var">fromMondayStartWeek</span></a></span></span><span> </span><span id="local-6989586621679068050"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068050"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span id="local-6989586621679068049"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068049"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679068048"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068048"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-comment">-- first day of the year</span><span>
</span><span id="line-77"></span><span>    </span><span id="local-6989586621679068047"><span class="annot"><span class="annottext">firstDay :: Day
</span><a href="#local-6989586621679068047"><span class="hs-identifier hs-var hs-var">firstDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDate"><span class="hs-identifier hs-var">fromOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068050"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-78"></span><span>
</span><span id="line-79"></span><span>    </span><span class="hs-comment">-- 0-based year day of first monday of the year</span><span>
</span><span id="line-80"></span><span>    </span><span id="local-6989586621679068042"><span class="annot"><span class="annottext">zbFirstMonday :: Integer
</span><a href="#local-6989586621679068042"><span class="hs-identifier hs-var hs-var">zbFirstMonday</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">5</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#toModifiedJulianDay"><span class="hs-identifier hs-var hs-var">toModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068047"><span class="hs-identifier hs-var">firstDay</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span>
</span><span id="line-81"></span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-comment">-- 0-based week of year</span><span>
</span><span id="line-83"></span><span>    </span><span id="local-6989586621679068039"><span class="annot"><span class="annottext">zbWeek :: Int
</span><a href="#local-6989586621679068039"><span class="hs-identifier hs-var hs-var">zbWeek</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068049"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-comment">-- 0-based day of week</span><span>
</span><span id="line-86"></span><span>    </span><span id="local-6989586621679068036"><span class="annot"><span class="annottext">zbDay :: Int
</span><a href="#local-6989586621679068036"><span class="hs-identifier hs-var hs-var">zbDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068048"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-comment">-- 0-based day in year</span><span>
</span><span id="line-89"></span><span>    </span><span id="local-6989586621679068029"><span class="annot"><span class="annottext">zbYearDay :: Integer
</span><a href="#local-6989586621679068029"><span class="hs-identifier hs-var hs-var">zbYearDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068042"><span class="hs-identifier hs-var">zbFirstMonday</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068039"><span class="hs-identifier hs-var">zbWeek</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068036"><span class="hs-identifier hs-var">zbDay</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#addDays"><span class="hs-identifier hs-var">addDays</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068029"><span class="hs-identifier hs-var">zbYearDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068047"><span class="hs-identifier hs-var">firstDay</span></a></span><span>
</span><span id="line-92"></span><span>
</span><span id="line-93"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#fromMondayStartWeekValid"><span class="hs-identifier hs-type">fromMondayStartWeekValid</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-comment">-- ^ Year.</span><span>
</span><span id="line-94"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Monday-starting week number (as @%W@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-95"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Day of week.</span><span>
</span><span id="line-96"></span><span>                               </span><span class="hs-comment">-- Monday is 1, Sunday is 7 (as @%u@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-97"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-98"></span><span id="fromMondayStartWeekValid"><span class="annot"><span class="annottext">fromMondayStartWeekValid :: Integer -&gt; Int -&gt; Int -&gt; Maybe Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromMondayStartWeekValid"><span class="hs-identifier hs-var hs-var">fromMondayStartWeekValid</span></a></span></span><span> </span><span id="local-6989586621679068026"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068026"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span id="local-6989586621679068025"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068025"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679068024"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068024"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-99"></span><span>    </span><span id="local-6989586621679068023"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068023"><span class="hs-identifier hs-var">d'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int -&gt; Maybe Int
forall t. Ord t =&gt; t -&gt; t -&gt; t -&gt; Maybe t
</span><a href="Data.Time.Calendar.Private.html#clipValid"><span class="hs-identifier hs-var">clipValid</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">7</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068024"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-100"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-101"></span><span>        </span><span class="hs-comment">-- first day of the year</span><span>
</span><span id="line-102"></span><span>        </span><span id="local-6989586621679068022"><span class="annot"><span class="annottext">firstDay :: Day
</span><a href="#local-6989586621679068022"><span class="hs-identifier hs-var hs-var">firstDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDate"><span class="hs-identifier hs-var">fromOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068026"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span>        </span><span class="hs-comment">-- 0-based week of year</span><span>
</span><span id="line-105"></span><span>        </span><span id="local-6989586621679068017"><span class="annot"><span class="annottext">zbFirstMonday :: Integer
</span><a href="#local-6989586621679068017"><span class="hs-identifier hs-var hs-var">zbFirstMonday</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">5</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#toModifiedJulianDay"><span class="hs-identifier hs-var hs-var">toModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068022"><span class="hs-identifier hs-var">firstDay</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span>
</span><span id="line-106"></span><span>
</span><span id="line-107"></span><span>        </span><span class="hs-comment">-- 0-based week number</span><span>
</span><span id="line-108"></span><span>        </span><span id="local-6989586621679068014"><span class="annot"><span class="annottext">zbWeek :: Int
</span><a href="#local-6989586621679068014"><span class="hs-identifier hs-var hs-var">zbWeek</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068025"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span>        </span><span class="hs-comment">-- 0-based day of week</span><span>
</span><span id="line-111"></span><span>        </span><span id="local-6989586621679068011"><span class="annot"><span class="annottext">zbDay :: Int
</span><a href="#local-6989586621679068011"><span class="hs-identifier hs-var hs-var">zbDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068023"><span class="hs-identifier hs-var">d'</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span>        </span><span class="hs-comment">-- 0-based day in year</span><span>
</span><span id="line-114"></span><span>        </span><span id="local-6989586621679068004"><span class="annot"><span class="annottext">zbYearDay :: Integer
</span><a href="#local-6989586621679068004"><span class="hs-identifier hs-var hs-var">zbYearDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068017"><span class="hs-identifier hs-var">zbFirstMonday</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068014"><span class="hs-identifier hs-var">zbWeek</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068011"><span class="hs-identifier hs-var">zbDay</span></a></span><span>
</span><span id="line-115"></span><span>
</span><span id="line-116"></span><span>    </span><span id="local-6989586621679068003"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068003"><span class="hs-identifier hs-var">zbYearDay'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer -&gt; Maybe Integer
forall t. Ord t =&gt; t -&gt; t -&gt; t -&gt; Maybe t
</span><a href="Data.Time.Calendar.Private.html#clipValid"><span class="hs-identifier hs-var">clipValid</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Bool
</span><a href="Data.Time.Calendar.OrdinalDate.html#isLeapYear"><span class="hs-identifier hs-var">isLeapYear</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068026"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">365</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">364</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068004"><span class="hs-identifier hs-var">zbYearDay</span></a></span><span>
</span><span id="line-117"></span><span>    </span><span class="annot"><span class="annottext">Day -&gt; Maybe Day
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Day -&gt; Maybe Day) -&gt; Day -&gt; Maybe Day
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#addDays"><span class="hs-identifier hs-var">addDays</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068003"><span class="hs-identifier hs-var">zbYearDay'</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679068022"><span class="hs-identifier hs-var">firstDay</span></a></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="hs-comment">-- | The inverse of 'sundayStartWeek'. Get a 'Day' given the year and</span><span>
</span><span id="line-120"></span><span class="hs-comment">-- the number of the day of a Sunday-starting week.</span><span>
</span><span id="line-121"></span><span class="hs-comment">-- The first Sunday is the first day of week 1, any earlier days in the</span><span>
</span><span id="line-122"></span><span class="hs-comment">-- year are week 0 (as @%U@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-123"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#fromSundayStartWeek"><span class="hs-identifier hs-type">fromSundayStartWeek</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-comment">-- ^ Year.</span><span>
</span><span id="line-124"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Sunday-starting week number (as @%U@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-125"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Day of week</span><span>
</span><span id="line-126"></span><span>                               </span><span class="hs-comment">-- Sunday is 0, Saturday is 6 (as @%w@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-127"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-128"></span><span id="fromSundayStartWeek"><span class="annot"><span class="annottext">fromSundayStartWeek :: Integer -&gt; Int -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromSundayStartWeek"><span class="hs-identifier hs-var hs-var">fromSundayStartWeek</span></a></span></span><span> </span><span id="local-6989586621679068001"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068001"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span id="local-6989586621679068000"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068000"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679067999"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067999"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-129"></span><span>    </span><span class="hs-comment">-- first day of the year</span><span>
</span><span id="line-130"></span><span>    </span><span id="local-6989586621679067998"><span class="annot"><span class="annottext">firstDay :: Day
</span><a href="#local-6989586621679067998"><span class="hs-identifier hs-var hs-var">firstDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDate"><span class="hs-identifier hs-var">fromOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679068001"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span>    </span><span class="hs-comment">-- 0-based year day of first monday of the year</span><span>
</span><span id="line-133"></span><span>    </span><span id="local-6989586621679067993"><span class="annot"><span class="annottext">zbFirstSunday :: Integer
</span><a href="#local-6989586621679067993"><span class="hs-identifier hs-var hs-var">zbFirstSunday</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#toModifiedJulianDay"><span class="hs-identifier hs-var hs-var">toModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679067998"><span class="hs-identifier hs-var">firstDay</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span>
</span><span id="line-134"></span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-comment">-- 0-based week of year</span><span>
</span><span id="line-136"></span><span>    </span><span id="local-6989586621679067990"><span class="annot"><span class="annottext">zbWeek :: Int
</span><a href="#local-6989586621679067990"><span class="hs-identifier hs-var hs-var">zbWeek</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679068000"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span>    </span><span class="hs-comment">-- 0-based day of week</span><span>
</span><span id="line-139"></span><span>    </span><span id="local-6989586621679067989"><span class="annot"><span class="annottext">zbDay :: Int
</span><a href="#local-6989586621679067989"><span class="hs-identifier hs-var hs-var">zbDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067999"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-comment">-- 0-based day in year</span><span>
</span><span id="line-142"></span><span>    </span><span id="local-6989586621679067982"><span class="annot"><span class="annottext">zbYearDay :: Integer
</span><a href="#local-6989586621679067982"><span class="hs-identifier hs-var hs-var">zbYearDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067993"><span class="hs-identifier hs-var">zbFirstSunday</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067990"><span class="hs-identifier hs-var">zbWeek</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067989"><span class="hs-identifier hs-var">zbDay</span></a></span><span>
</span><span id="line-143"></span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#addDays"><span class="hs-identifier hs-var">addDays</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067982"><span class="hs-identifier hs-var">zbYearDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679067998"><span class="hs-identifier hs-var">firstDay</span></a></span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span class="annot"><a href="Data.Time.Calendar.OrdinalDate.html#fromSundayStartWeekValid"><span class="hs-identifier hs-type">fromSundayStartWeekValid</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Integer</span></span><span> </span><span class="hs-comment">-- ^ Year.</span><span>
</span><span id="line-147"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Sunday-starting week number (as @%U@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-148"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>     </span><span class="hs-comment">-- ^ Day of week.</span><span>
</span><span id="line-149"></span><span>                               </span><span class="hs-comment">-- Sunday is 0, Saturday is 6 (as @%w@ in 'Data.Time.Format.formatTime').</span><span>
</span><span id="line-150"></span><span>                    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="Data.Time.Calendar.Days.html#Day"><span class="hs-identifier hs-type">Day</span></a></span><span>
</span><span id="line-151"></span><span id="fromSundayStartWeekValid"><span class="annot"><span class="annottext">fromSundayStartWeekValid :: Integer -&gt; Int -&gt; Int -&gt; Maybe Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromSundayStartWeekValid"><span class="hs-identifier hs-var hs-var">fromSundayStartWeekValid</span></a></span></span><span> </span><span id="local-6989586621679067980"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067980"><span class="hs-identifier hs-var">year</span></a></span></span><span> </span><span id="local-6989586621679067979"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067979"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span id="local-6989586621679067978"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067978"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-keyword">do</span><span>
</span><span id="line-152"></span><span>    </span><span id="local-6989586621679067977"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067977"><span class="hs-identifier hs-var">d'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int -&gt; Maybe Int
forall t. Ord t =&gt; t -&gt; t -&gt; t -&gt; Maybe t
</span><a href="Data.Time.Calendar.Private.html#clipValid"><span class="hs-identifier hs-var">clipValid</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">6</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067978"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-keyword">let</span><span>
</span><span id="line-154"></span><span>        </span><span class="hs-comment">-- first day of the year</span><span>
</span><span id="line-155"></span><span>        </span><span id="local-6989586621679067976"><span class="annot"><span class="annottext">firstDay :: Day
</span><a href="#local-6989586621679067976"><span class="hs-identifier hs-var hs-var">firstDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Int -&gt; Day
</span><a href="Data.Time.Calendar.OrdinalDate.html#fromOrdinalDate"><span class="hs-identifier hs-var">fromOrdinalDate</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067980"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-156"></span><span>
</span><span id="line-157"></span><span>        </span><span class="hs-comment">-- 0-based week of year</span><span>
</span><span id="line-158"></span><span>        </span><span id="local-6989586621679067971"><span class="annot"><span class="annottext">zbFirstSunday :: Integer
</span><a href="#local-6989586621679067971"><span class="hs-identifier hs-var hs-var">zbFirstSunday</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">4</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Day -&gt; Integer
</span><a href="Data.Time.Calendar.Days.html#toModifiedJulianDay"><span class="hs-identifier hs-var hs-var">toModifiedJulianDay</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679067976"><span class="hs-identifier hs-var">firstDay</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Integral a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Real.html#mod"><span class="hs-operator hs-var">`mod`</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-comment">-- 0-based week number</span><span>
</span><span id="line-161"></span><span>        </span><span id="local-6989586621679067968"><span class="annot"><span class="annottext">zbWeek :: Int
</span><a href="#local-6989586621679067968"><span class="hs-identifier hs-var hs-var">zbWeek</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067979"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-comment">-- 0-based day of week</span><span>
</span><span id="line-164"></span><span>        </span><span id="local-6989586621679067967"><span class="annot"><span class="annottext">zbDay :: Int
</span><a href="#local-6989586621679067967"><span class="hs-identifier hs-var hs-var">zbDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067977"><span class="hs-identifier hs-var">d'</span></a></span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span>        </span><span class="hs-comment">-- 0-based day in year</span><span>
</span><span id="line-167"></span><span>        </span><span id="local-6989586621679067960"><span class="annot"><span class="annottext">zbYearDay :: Integer
</span><a href="#local-6989586621679067960"><span class="hs-identifier hs-var hs-var">zbYearDay</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067971"><span class="hs-identifier hs-var">zbFirstSunday</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">7</span></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067968"><span class="hs-identifier hs-var">zbWeek</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2B"><span class="hs-operator hs-var">+</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Integer
forall a. Integral a =&gt; a -&gt; Integer
</span><a href="../../base/src/GHC.Real.html#toInteger"><span class="hs-identifier hs-var">toInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621679067967"><span class="hs-identifier hs-var">zbDay</span></a></span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span>    </span><span id="local-6989586621679067959"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067959"><span class="hs-identifier hs-var">zbYearDay'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Integer -&gt; Integer -&gt; Maybe Integer
forall t. Ord t =&gt; t -&gt; t -&gt; t -&gt; Maybe t
</span><a href="Data.Time.Calendar.Private.html#clipValid"><span class="hs-identifier hs-var">clipValid</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">0</span></span><span> </span><span class="hs-special">(</span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Bool
</span><a href="Data.Time.Calendar.OrdinalDate.html#isLeapYear"><span class="hs-identifier hs-var">isLeapYear</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067980"><span class="hs-identifier hs-var">year</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">365</span></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Integer
</span><span class="hs-number">364</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067960"><span class="hs-identifier hs-var">zbYearDay</span></a></span><span>
</span><span id="line-170"></span><span>    </span><span class="annot"><span class="annottext">Day -&gt; Maybe Day
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Day -&gt; Maybe Day) -&gt; Day -&gt; Maybe Day
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Integer -&gt; Day -&gt; Day
</span><a href="Data.Time.Calendar.Days.html#addDays"><span class="hs-identifier hs-var">addDays</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621679067959"><span class="hs-identifier hs-var">zbYearDay'</span></a></span><span> </span><span class="annot"><span class="annottext">Day
</span><a href="#local-6989586621679067976"><span class="hs-identifier hs-var">firstDay</span></a></span><span>
</span><span id="line-171"></span></pre></body></html>